from django.db import models
from django_quill.fields import QuillField
from django.contrib.auth.models import User

# Create your models here.

class Student(models.Model):
	student_intro = QuillField(blank=True)
	bool_intro = models.BooleanField(default=False)
	name = models.CharField(max_length=10)
	seat_number = models.IntegerField()
	qq_number = models.CharField(max_length=20, blank=True)
	phone_number = models.CharField(max_length=20, blank=True)
	last_edit = models.DateTimeField(auto_now=True)
	last_edit_name = models.CharField(max_length=100,blank=True)
	html_text = models.TextField(null=True,blank=True)
	user = models.OneToOneField(User, on_delete=models.CASCADE)

	def __str__(self):
		return self.name

class Student_last(models.Model):
	student_info = QuillField()
	qq_number = models.CharField(max_length=20, blank=True)
	phone_number = models.CharField(max_length=20, blank=True)
	last_edit = models.DateTimeField()
	last_edit_name = models.CharField(max_length=100)
	history = models.ForeignKey(Student, on_delete=models.CASCADE, null=True, blank=True, related_name='history')
	html_text = models.TextField(default='')

class Rating(models.Model):
	iq = models.FloatField()
	eq = models.FloatField()
	relation = models.FloatField()
	comment = models.TextField()
	grader = models.ForeignKey(User, on_delete=models.CASCADE)
	be_graded = models.ForeignKey(Student, on_delete=models.CASCADE)
	is_private = models.BooleanField(default=False)